-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Selam Ainalem Brittany Jones #22
base: master
Are you sure you want to change the base?
Conversation
…dex for customers controller
…upport creation of a rental and reduction to inventory in associated movie object.
… schema, made slight updates to check_out methods and added a few assertions to rental_controller_test.rb
…smoke tests before submitting.
Video StoreWhat We're Looking For
|
|
||
}.must_change 'Movie.count', 1 | ||
|
||
JSON.parse(response.body)["id"].must_equal 1072689925 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is failing because you can't really guantee the ID the test is going to generate, it probably doesn't need to be there.
Better would be:
JSON.parse(response.body).keys.must_include "id"
movie.errors.messages.must_include :release_date | ||
end | ||
|
||
it "must have title" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be repetitive
end | ||
|
||
describe 'a_check_in' do | ||
it 'must increase inventory by 1' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about checking in a movie that's not checked out?
end | ||
end | ||
|
||
describe "relations" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Business logic tests?
@@ -0,0 +1,226 @@ | |||
require "test_helper" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about what happens when you try to check in a movie that's not checked out by that customer?
Video Store API
Congratulations! You're submitting your assignment!
If you didn't get to the functionality the question is asking about, reply with what you would have done if you had completed it.
Comprehension Questions
Describe a set of positive and negative test cases you implemented for a model. | For the rental model we tested for a case in which all required values were provided movie ID and customer ID. To test for a negative case we simulated a post action in which the customer ID, and also the movie Id was not provided.
Describe a set of positive and negative test cases you implemented for a controller. | For the get movie path we tested for an existing movie and for a non existing movie. An existing movie returned a hash with all movie information, and a non existing movie returned 404 not found
How does your API respond when bad data is sent to it? | In the case for a request to check_out a movie with a customer_id that does not exist, the API will respond with an error json, that sends back a message that the customer’s id is missing.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. | The reduction of available inventory is kept in a model method. Updating and saving an active record model seemed like business logic that should be kept outside of the controller.
Do you have any recommendations on how we could improve this project for the next cohort? | For the next cohort, I think there should be more instruction on using Smoke tests, and RABL.
Link to Trello | https://trello.com/b/vNEXohNE/video-store-api
Link to ERD | https://www.lucidchart.com/documents/edit/53439e24-0646-4b9e-acfc-5691c657c1a5/0?shared=true&existing=1&docId=53439e24-0646-4b9e-acfc-5691c657c1a5